//
//  BSCategotyCell.m
//  BaiSi
//
//  Created by Sycamore on 16/5/9.
//  Copyright © 2016年 Sycamore. All rights reserved.
//

#import "BSCategotyCell.h"
#import "BSCategoryItem.h"

@interface BSCategotyCell ()

@property (weak, nonatomic) IBOutlet UIView *leftView;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@end

@implementation BSCategotyCell

- (void)awakeFromNib {
    // Initialization code
    self.contentView.backgroundColor = BSTintColor;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

//当选中一个cell和取消选中一个cell的时候就会调用此方法
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
    //选中状态下才显示红色的view
    _leftView.hidden = !selected;
    _titleLabel.textColor = selected ? [UIColor redColor] : [UIColor blackColor];
}

- (void)setItem:(BSCategoryItem *)item
{
    _item = item;
    _titleLabel.text = item.name;
}

@end
